let express=require('express');
let router = express.Router();


router.post('/', function(req, res, next) {
  var pool = global.POOL;
  var query = async () => {
    var connect = await pool.connect()
    try {
      await connect.query('UPDATE contents SET deleted=$1 WHERE id=$2', [true, req.body.contentid])
      res.send({delete:'ok'});
    } finally {
      connect.release()
    }
  }

  query().catch(e => {
    res.send({delete:'error'});
    console.error(e.message, e.stack)});
});


module.exports = router;
